-- 影骇响震
local yinghaixiangzheng = fk.CreateSkill {
    name = "mcdh_yinghaixiangzheng",
    frequency = Skill.Limited,
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

yinghaixiangzheng:addEffect('active',{
    can_use = function(self, player)
        return player:usedSkillTimes(self.name, Player.HistoryGame) == 0
    end,
    card_filter = Util.FalseFunc,
    target_num = 2,
    target_filter = function (self,player, to_select, selected)
        local target = to_select
        if #selected == 0 then
            return true
        elseif #selected == 1 then
            return selected[1]:canMoveCardsInBoardTo(target, nil)
        end
    end,
    on_use =function(self, room, effect)
        local player = effect.from
        local result = room:askToMoveCardInBoard(player, {target_one=effect.tos[1],target_two = effect.tos[2],skill_name=self.name})
        local events = player.room.logic:getEventsByRule(GameEvent.MoveCards, 1, function(e)
            for _, move in ipairs(e.data) do
                if move.skillName == self.name then
                    return true
                end
            end
        end,player.room.logic:getCurrentEvent():findParent(GameEvent.Phase, true).id)
        if #events > 0 then
            for _, move in ipairs(events[1].data) do
                if move.skillName == self.name then
                    for _, info in ipairs(move.moveInfo) do
                        if info.fromArea == Card.PlayerEquip  then
                            room:askToUseVirtualCard(move.from,{name='slash',skill_name=self.name,prompt="#mcdh_yinghaixiangzheng_use",cancelable=false,extra_data={bypass_times=true,extraUse=true}})

                            break
                        end
                    end
                end
            end
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_yinghaixiangzheng"] = "影骇响震",
    [":mcdh_yinghaixiangzheng"] = "限定技，出牌阶段，你可以移动场上一张牌，然后以此法失去牌的角色视为使用一张的【杀】。",
    ["#mcdh_yinghaixiangzheng_use"] = "影骇响震:视为使用一张的【杀】。"
}

return yinghaixiangzheng